import {cateList} from '../../../request/api'

const state = {
    // 商品分类列表
    catelist:[]
}

const getters = {
    getCate(state){
        return state.catelist
    }
}

const mutations = {
    CATELIST(state,payload){
        state.catelist = payload
    }
}

const actions = {
    // getCateListActions({commit}){
    //     cateList(payload).then(res => {
    //         if(res.code == 200){
    //             commit('CATELIST',res.list)
    //         }
    //     })
    // },

    async getCateListActions({commit}) {
        let res = await cateList({
          istree:1
        });
        // console.log(res);
        commit('CATELIST',res.list)
      },

    // getCateListActions({commit}){
    //     cateList({
    //         istree:1
    //     })
    //     .then(res => {
    //         commit('CATELIST',res.list)
    //     })
    // }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}